import Data.List

solve :: [Int] -> [Int]
solve [] = []
solve xs = length nextList : solve nextList
    where m = minimum xs
          nextList = filter (>0) [x-m | x <- xs]

main = do
    l1 <- getLine
    l2 <- getLine
    let n = l1
        a = map read $ words l2
    putStrLn n
    mapM (putStrLn . show) $ init $ solve a
    